const friend = {
  data () {
    return {
      letter: '全部',
      friendList: [],
      friendSet: new Set()
    }
  },
  methods: {
    // 点击字母事件
    friendClick (e) {
      let text = e.target.innerText
      if (text === '@') {
        text = ''
        this.letter = '全部'
      } else {
        this.letter = text
      }
      this.getFriend(text)
    },

    // 获取我的朋友
    getFriend (friendFletter = '') {
      const data = {
        'query.schType': 1,
        'query.schCond': this.searchName,
        'query.pageSize': 1000,
        'query.friendFletter': friendFletter,
        'query.currentPage': 1
      }
      this.$axios({
        method: 'post',
        url: `${this.$site.homeServer}/front/retrieve/friendcontact.htm`,
        data: this.$qs.stringify(data, {indices: false})
      }).then(res => {
        this.friendList = res.data.list
      })
    }
  }
}

export default friend
